package com.wayhome.srpingbootmybatis.boc.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wayhome.srpingbootmybatis.boc.consts.BocOnePayConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@ApiModel(value = "支付码支付消费（B 扫 C）返回结果")
@JsonIgnoreProperties(ignoreUnknown = true)
public class BocPayRespDTO {


    @ApiModelProperty(value = "支付方式", notes = "ZFBA-支付宝 WEIX-微信 UPAY-银联二维码(暂不支持) DZZF-电子支付 UN-未知")
    @JsonProperty("PayType")
    private String PayType;

    @ApiModelProperty(value = "支付授权码")
    @JsonProperty("AuthCode")
    private String AuthCode;

    @ApiModelProperty(value = "交易金额", notes = "金额以分为单位不包含小数，不足 12 位左补“0”:000000000001，代 表1分钱")
    @JsonProperty("TranAmt")
    private String TranAmt;

    @ApiModelProperty(value = "交易币种", notes = "固定填156")
    @JsonProperty("CcyCode")
    private String CcyCode;

    @ApiModelProperty(value = "商户附言", notes = "仅微信支付宝交易有效，其他交易 传此信息无意义")
    @JsonProperty("Body")
    private String Body;

    @ApiModelProperty(value = "返回码", notes = "000000-交易成功")
    @JsonProperty("RespCode")
    private String RespCode;

    @ApiModelProperty(value = "交易结果描述", notes = "交易结果描述")
    @JsonProperty("RespMsg")
    private String RespMsg;

    @ApiModelProperty(value = "银行交易日期", notes = "成功时返回")
    @JsonProperty("BankDate")
    private String BankDate;

    @ApiModelProperty(value = "银行交易时间", notes = "成功时返回")
    @JsonProperty("BankTime")
    private String BankTime;

    @ApiModelProperty(value = "商户订单号", notes = "仅在支付宝、微信、电子支付交易成功时返回此域对于澳门通支付，此订单号对于网联流水对应的是交易流水号")
    @JsonProperty("OrderNo")
    private String OrderNo;

    @ApiModelProperty(value = "支付宝单号", notes = "仅PayType=ZFBA 时此域有值")
    @JsonProperty("TradeNo")
    private String TradeNo;

    @ApiModelProperty(value = "微信单号", notes = "微信返回的交易单号 仅PayType=WEIX 时此域有值")
    @JsonProperty("TradeId")
    private String TradeId;

    @ApiModelProperty(value = "第三方订单号", notes = "仅PayType=DZZF 时此域有值")
    @JsonProperty("OthTradeNo")
    private String OthTradeNo;

    @ApiModelProperty(value = "银联付款凭证号", notes = "仅PayType=UPAY 时此域有值")
    @JsonProperty("PayVounum")
    private String PayVounum;

    @ApiModelProperty(value = "银联付款凭订单号", notes = "仅PayType=UPAY 时此域有值")
    @JsonProperty("PayNo")
    private String PayNo;

    @ApiModelProperty(value = "支付有效时间", notes = "上送值超出限定时间范围，请以返 回为准，以分单， 默认 1 分钟， 最大 10 分钟 注:目前仅支持微信、支付宝、电 子支付上送此字段，其余交易均不支持。即使传入此字段也无作用。")
    @JsonProperty("PayValidTime")
    private String PayValidTime;

    @ApiModelProperty(value = "优惠金额", notes = "易存在优惠时才返回(目前暂时无法使用)")
    @JsonProperty("DisPrice")
    private String DisPrice;

    @ApiModelProperty(value = "实付金额", notes = "现金支付金额，支付实际金额， 仅PayType=DZZF 时此域有值")
    @JsonProperty("CashAmount")
    private String CashAmount;

    @ApiModelProperty(value = "买家账号ID", notes = "当 OldPayType=ZFBA 时此域为 买家在支付宝的用户 id;当 OldPayType=WEIX 时此域为 微信买家 OPENID;")
    @JsonProperty("BuyerId")
    private String BuyerId;

    @ApiModelProperty(value = "用户子标识", notes = "用户在子商户 appid 下的唯一 标识,当传入 SupAppId 才返回此值")
    @JsonProperty("SubOpenId")
    private String SubOpenId;

    @JSONField(name="MsgVer")
    @JsonProperty("MsgVer")
    @ApiModelProperty(value = "报文版本")
    public String MsgVer;

    @ApiModelProperty(value = "前端系统日期", notes = "日期格式:yyyyMMdd")
    @JsonProperty("InDate")
    @JSONField(name="InDate")
    public String InDate;

    @ApiModelProperty(value = "前端系统时间", notes = "时间格式:HHmmss")
    @JsonProperty("InTime")
    @JSONField(name="InTime")
    public String InTime;

    @ApiModelProperty(value = "交易编码")
    @JsonProperty("TranId")
    @JSONField(name="TranId")
    public String TranId;

    @ApiModelProperty(value = "业务编号")
    @JsonProperty("BussId")
    @JSONField(name="BussId")
    public String BussId;

    @ApiModelProperty(value = "接入商户类型 01-普通商户 02-第三方支付机构")
    @JsonProperty("MerTp")
    @JSONField(name="MerTp")
    public String MerTp;

    @ApiModelProperty(value = "报文方向", notes = "11 请求/通知报文  12应答报文")
    @JsonProperty("Drctn")
    @JSONField(name="Drctn")
    public String Drctn;

    @ApiModelProperty(value = "商户号", notes = "当storNo(机器/门店号出现时可以不上传")
    @JsonProperty("MerId")
    @JSONField(name="MerId")
    public String MerId;

    @ApiModelProperty(value = "终端号", notes = "当storNo(机器/门店号出现时可以不上传")
    @JsonProperty("TermId")
    @JSONField(name="TermId")
    public String TermId;

    @ApiModelProperty(value = "门店号/机器号")
    @JsonProperty("StorNo")
    @JSONField(name="StorNo")
    public String StorNo;

    @ApiModelProperty(value = "唯一支付流水号")
    @JSONField(name="PayLs")
    @JsonProperty("PayLs")
    public String PayLs;

    @ApiModelProperty(value = "终端流水号", notes = "生成连续的 6 位流水号")
    @JSONField(name="TraceNo")
    @JsonProperty("TraceNo")
    public String TraceNo;

    @ApiModelProperty(value = "批次号", notes = "批次号可以当天日期为一个批次号")
    @JSONField(name="BatchNo")
    @JsonProperty("BatchNo")
    public String BatchNo;

    @ApiModelProperty(value = "外部商户订单号", notes = "请求:如前端系统存在此域则上送;回应:同请求")
    @JsonProperty("MerOrderNo")
    @JSONField(name="MerOrderNo")
    public String MerOrderNo;

    @ApiModelProperty(value = "信息备注", notes = "备注信息商户有需要时上传")
    @JSONField(name="Attach")
    @JsonProperty("Attach")
    public String Attach;

    @ApiModelProperty(value = "签名", notes = "待签名信息由以下格式组成，MerId|TermId|Payls|TraceNo\n" +
            "或者MerId 和 TermId 不存在时采用 StorNo|Payls|TraceNo|TranId")
    @JSONField(name="Sign")
    @JsonProperty("Sign")
    public String Sign;

    public String signStr() {
        return MerId + BocOnePayConst.SIGN_SPLIT + TermId + BocOnePayConst.SIGN_SPLIT + PayLs + BocOnePayConst.SIGN_SPLIT + TraceNo;
    }


}
